<script setup>
import { onMounted, nextTick, ref, reactive, watch } from 'vue'
const activeType = ref(0)
const activeTypeSty = reactive({
  color: '#fff',
  background: '#1890ff'
})
const forecastHaiyu = () => {
  activeType.value = 0
}

const forecastYuchang = () => {
  activeType.value = 1
}
</script>

<template>
  <div class="Card">
    <div id="detail_contain">
      <div id="detail_type">
        <div class="type_btn" @click="forecastHaiyu" :style="activeType == 0 ? activeTypeSty : ''">海域预报</div>
        <div class="type_btn" @click="forecastYuchang" :style="activeType == 1 ? activeTypeSty : ''">渔场预报
        </div>
      </div>
      <div id="detail_date">
        <a-button type="" shape="round" size="large">
          6月9日
        </a-button>
        <a-button type="" shape="round" size="large">
          6月10日
        </a-button>
      </div>
      <div id="detail_info">
        <div class="info_item">1</div>
        <div class="info_item">2</div>
        <div class="info_item">3</div>
        <div class="info_item">4</div>
      </div>
    </div>
  </div>
</template>

<style lang='less' scoped>
.Card {
  border-radius: 12px;
  overflow: hidden;
  box-shadow: 0 2px 4px rgba(0, 0, 0, .3);
  border: 1px solid rgba(235, 235, 235, .38);

  #detail_contain {
    padding: 10px;
    height: 100%;
    width: 100%;
    display: flex;
    flex-direction: column;
    justify-content: space-between;

    #detail_type {
      height: 45px;
      width: 100%;
      border-bottom: 1px solid var(--border-color);
      display: flex;
      justify-content: center;
      align-items: center;
      font-size: 14px;
      font-weight: bold;
      // border: 1px solid tomato;
      border-top-left-radius: 5px;
      border-top-right-radius: 5px;
      overflow: hidden;

      .type_btn {
        height: 100%;
        width: 50%;
        background-color: #eaeaea;
        display: flex;
        justify-content: center;
        align-items: center;
        cursor: pointer;
        // 背景颜色transition
        transition: all 0.3s ease-in-out;
      }
    }

    #detail_date {
      height: 60px;
      width: 100%;
      border-bottom: 1px solid var(--border-color);
      display: flex;
      justify-content: space-around;
      align-items: center;
      font-size: 20px;
      font-weight: bold;
    }

    #detail_info {
      height: calc(100% - 105px);
      width: 100%;
      font-size: 20px;
      font-weight: bold;
      overflow: auto;
      position: relative;
      display: flex;
      flex-direction: column;
      align-items: center;

      &::-webkit-scrollbar {
        width: 5px;
        height: 5px;
      }

      &:hover::-webkit-scrollbar {
        display: block;
      }

      &::-webkit-scrollbar-thumb {
        border-radius: 5px;
        background-color: transparent;
      }

      &:hover::-webkit-scrollbar-thumb {
        background-color: gray;
      }


      .info_item {
        margin-bottom: 10px;
        width: 95%;
        height: 200px;
        flex-shrink: 0;
        border-radius: 12px;
        overflow: hidden;
        box-shadow: 0 2px 4px rgba(0, 0, 0, .3);
        border: 1px solid rgba(235, 235, 235, .38);
      }
    }
  }
}
</style>